package com.socialuni.sdk.model;

import com.socialuni.sdk.model.DO.user.UserDO;
import com.socialuni.sdk.repository.UserRepository;
import com.socialuni.sdk.utils.UserUtils;
import lombok.Data;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author qinkaiyuan
 * @date 2019-08-14 17:24
 */
@Data//
@Component
public class MessageUserVO {
    private static UserRepository userRepository;

    @Resource
    public void setUserRepository(UserRepository userRepository) {
        MessageUserVO.userRepository = userRepository;
    }


    // 前端遍历使用
    private String id;
    private String nickname;
    private String avatar;
    private Boolean vipFlag;

    public MessageUserVO() {
    }

    public MessageUserVO(Integer sendUserId,  Integer receiveUserId) {
            //待定，需要确认这个user哪里来的。
            UserDO user = UserUtils.get(sendUserId);
//            this.id = UnionIdDbUtil.createUserUid(user.getId(),  receiveUserId);
            //消息的用户
            this.nickname = user.getNickname();
            this.avatar = user.getAvatar();
//            this.vipFlag = user.getVipFlag();
    }
}
